package com.hiwan.unions.activity.main.fragment;

import android.os.Build;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;

import com.hiwan.unions.R;
import com.hiwan.unions.activity.main.fragment.base.RootFragment;
import com.hiwan.unions.adapter.fragmentAdapters.FragmentAdapter_POP;
import com.hiwan.unions.util.StartIntent;
import com.hiwan.unions.view.NavigationView;

/**
 * Created by llg on 2017/7/10.
 */
public class WorkersFragment extends RootFragment {
    private GridView gridView;
    private int[] imageUrls = {R.mipmap.jyfw_2, R.mipmap.cyfw, R.mipmap.knxf_2, R.mipmap.hzbz,
            R.mipmap.flbz, R.mipmap.flyz, R.mipmap.flzsk, R.mipmap.mmbbw_2,
            R.mipmap.hljy, R.mipmap.xlyz_2, R.mipmap.zccx_2, R.mipmap.ndbh_2,
            R.mipmap.jnpx_2, R.mipmap.fwzd_2, R.mipmap.spkt_2, R.mipmap.dzsw,
            R.mipmap.lyy_2, R.mipmap.wqdt_1, R.mipmap.nm_icon};
    public String[] title;
    private NavigationView navigationView;
    private FragmentAdapter_POP adapter;

    @Override
    public int getLayout() {
        canLoadMore = false;
        canRefresh = false;
        return R.layout.fragment_workes;
    }

    @Override
    protected void Interface() {
        super.Interface();
        // 当SDK版本号为19以上版本时
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            findView(R.id.RelaButtonTitlenear).setVisibility(View.VISIBLE);
        }
        navigationView = findView(R.id.navigationView);
        navigationView.getGoBackBtn().setVisibility(View.INVISIBLE);

        title = getResources().getStringArray(R.array.fragment_button_pop);
        gridView = findView(R.id.gridView);
        adapter = new FragmentAdapter_POP(getActivity());
        gridView.setAdapter(adapter);
        gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                StartIntent.get(getActivity()).contentStart(title[position], 0);

            }
        });
        adapter.setDates(title, imageUrls);
    }

    @Override
    protected void initData() {

    }
}
